package com.bxait.toymail.product.service.impl;

import com.bxait.com.utils.PageUtils;
import com.bxait.com.utils.Query;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.bxait.toymail.product.dao.SkuImagesDao;
import com.bxait.toymail.product.entity.SkuImagesEntity;
import com.bxait.toymail.product.service.SkuImagesService;


@Service("skuImagesService")
public class SkuImagesServiceImpl extends ServiceImpl<SkuImagesDao, SkuImagesEntity> implements SkuImagesService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<SkuImagesEntity> page = this.page(
                new Query<SkuImagesEntity>().getPage(params),
                new QueryWrapper<SkuImagesEntity>()
        );

        return new PageUtils(page);
    }

    /*
     * @param skuId
     * @==============History===============<br/>
     * @Description //   获取当前sku的图片信息
     * @Date 2023/4/17 2023/4/17 
     * @Author < a href="2277411582@qq.com">chen</ a>
     * @return [java.lang.Long]
     */
    @Override
    public List<SkuImagesEntity> getImagesBySkuId(Long skuId) {
        QueryWrapper<SkuImagesEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("sku_id", skuId);
        return this.list(queryWrapper);
    }

}